var http = require('http');

http.createServer(function (request, response) {
  if (request.url.indexOf('favicon') > -1) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.end('Hello World\n');
  } else {
    // 发送 HTTP 头部 
    // HTTP 状态值: 200 : OK
    // 内容类型: text/plain    
    response.writeHead(200, {'Content-Type': 'text/plain'});
    console.log(process.env.NODE_ENV); // undefined;
    response.write(process.env.NODE_ENV + "<br/>");
    // 发送响应数据 "Hello World"
    response.end('Hello World\n');
    // response.end(process.env.NODE_ENV);
  }
}).listen(8888);

// 终端打印如下信息
console.log('Server running at http://127.0.0.1:8888/');